<template>
  <el-row class="tac">
    <el-col :span="24">
      <el-menu
        default-active="2"
        class="el-menu-vertical-demo"
        unique-opened
        router
        @open="handleOpen"
        @close="handleClose">

        <el-submenu v-for="item in menu" :index="item.path" :key="item.path">
          <template slot="title">
            <span v-text="item.name"/>
          </template>
          <el-menu-item-group v-for="children in item.children" :key="children.path" class="over-hide">
            <el-menu-item :index="children.path" v-text="children.name"/>
          </el-menu-item-group>
        </el-submenu>

      </el-menu>
    </el-col>
  </el-row>
</template>

<script>
import menu from '../config/menu-config'

export default {
  data() {
    return {
      menu: menu
    }
  },
  methods: {
    handleOpen(key, keyPath) {
      console.log(key, keyPath)
    },
    handleClose(key, keyPath) {
      console.log(key, keyPath)
    }
  }
}
</script>

<style scoped>
  .over-hide{
    overflow: hidden;
  }
</style>
